/**
 * Copyright (C) 2011 The Android Open Source Project 
 * Emial : guoyil199@163.com
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0 
 * 
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License. 
 */ 
package com.test.fields;

import java.util.Random;


/**
 * @author THINK
 * @Email guoyil199@163.com
 * @version V1.0
 * @Date 2016年4月20日 下午3:13:42
 * @Title <B>todo</B>
 * <pre>todo</pre>
 */

public class Main {

	public static void main(String[] args) {
//		testSubString();
		random();
	}
	
	static void testSubString(){
		String test="蓝牌:0";
		System.out.println(test.substring(0,test.indexOf(':')));
		System.out.println(test.substring(test.indexOf(':')+1,test.length()));
	}
	
	static void random() {
//		random.nextInt(max)表示生成[0,max]之间的随机数，然后对(max-min+1)取模。
//		以生成[10,20]随机数为例，首先生成0-20的随机数，然后对(20-10+1)取模得到[0-10]之间的随机数，然后加上min=10，最后生成的是10-20的随机数
		int max = 99;
		int min = 10;
		Random random = new Random();
		for (int i = 0; i < 100; i++) {
			int s = random.nextInt(max) % (max - min + 1) + min;
			System.out.println(s);	
		}
		
	}
}
